const baseIp = import.meta.env.WAR_IP;
import { useAccessStore } from '@vben/stores';

/**
 * 获取所有战例
 */
const getAllSceneList = async (): Promise<[]> => {
  const res = await fetch(`http://localhost:3029/scene-list`);
  const data = await res.json();
  return data.data;
};

/**
 * 获取所有战例素材
 */
const getAllSceneAssets = async (): Promise<[]> => {
  const res = await fetch(`http://localhost:3029/file-list/getAllFile`);
  const data = await res.json();
  return data.data;
};

/**
 * 获取所有主题
 */
const getSceneTags = async () => {
  const accessStore = useAccessStore();
  const res = await fetch(`http://localhost:3029/scene-tags/get-all-tags`, {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${accessStore.accessToken}`  // 👈 添加 token 认证头
    }
  });
  const data = await res.json();
  return data.data;
};

export const navApi = {
  getAllSceneList,
  getAllSceneAssets,
  getSceneTags,
};
